﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:custom="clr-namespace:RingControls"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
  <Style TargetType="custom:Ring">
    <Setter Property="FontSize" Value="48" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="custom:Ring">
          <Grid
              Width="{TemplateBinding Width}"
              Height="{TemplateBinding Height}">
            <Canvas Canvas.ZIndex="1">
              <!-- circle background -->
              <Ellipse
                  StrokeThickness="{TemplateBinding Thickness}"
                  Stroke="{TemplateBinding Foreground}"
                  Width="{TemplateBinding Width}"
                  Height="{TemplateBinding Height}"
                  Opacity="{TemplateBinding RingOpacity}"
                  Fill="Transparent">
              </Ellipse>
            </Canvas>
            <!-- highlight ring -->
            <Path
                Canvas.ZIndex="3"
                x:Name="Highlight"
                Fill="{TemplateBinding Highlight}">
              <Path.Data>
                <PathGeometry>
                  <PathFigure
                      IsClosed="True">
                  </PathFigure>
                </PathGeometry>
              </Path.Data>
            </Path>
            <!-- contents -->
            <ContentPresenter
                x:Name="ContentContainer"
                Content="{TemplateBinding Content}"
                ContentTemplate="{TemplateBinding ContentTemplate}"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>